package com.woniuxy.financeassembly.apiimpl;


import com.woniuxy.common.Result;
import com.woniuxy.financeassembly.model.PlatformRecords;
import com.woniuxy.financeassembly.service.impl.PlatformRecordsServiceImpl;
import com.woniuxy.hotel.PlatformRecordsAPI;
import com.woniuxy.hotel.form.IncomeAccountForm;
import com.woniuxy.hotel.form.PlatformRecordsForm;
import com.woniuxy.hotel.form.SpendingAccountForm;
import lombok.extern.slf4j.Slf4j;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zz
 * @since 2021-05-24
 */
@RestController
@Slf4j
public class PlatformRecordsAPIController implements PlatformRecordsAPI{

    @Autowired
    private PlatformRecordsServiceImpl platformRecordsService;



    //平台流水
    @Override
    public Result account(Integer status, String time) {
        log.info("status是：{}，time是：{}",status,time);
        List<PlatformRecords> account = platformRecordsService.account(status,time);
        log.info("所有账单{}",account);
        return Result.success(account);
    }


    //生成收入流水
    @Override
    public Result addIncomeAccount(IncomeAccountForm incomeAccountForm) {
        platformRecordsService.addIncomeAccount(incomeAccountForm);
        return Result.success();
    }


    //生成支出流水（给商家打账）
    @Override
    public Result addSpendingAccount() {
        platformRecordsService.addDisburseAccount();
        return Result.success("转账成功");
    }

}

